export {}//确保跟其它文件没有成员冲突

class Person {
  public name: string
  private age:number=10 //要么定义声明;private私有外部无法访问
  protected readonly gender:boolean //protected只允许子类访问;readonly无法修改
  constructor(name:string){
    this.name=name;//要么构造函数中赋值
    this.gender=true;
  }

  say(msg:string):void{
    console.log(`I am ${this.name},${msg}`);
  }
}

class Student extends Person{
  private constructor (name:string,age:number){
    super(name);
    console.log(this.gender)//能访问父类成员
  }

  static create(name:string){
    return new Student(name,19);
  }
}

const tom=new Person('tom');

const jack=Student.create('jack')

